$(document).ready(function(){
    $('#alipayLogin').css('cursor','pointer').click( function(){ $('#alipaysubmit').submit();});
    $('#frmLogin').find('input:text[@name="user"]').keyup(function (){$(this).click();});
    $('#frmLogin').find('input:text[@name="user"]').click(
          function (){
            $('#responsebar').removeClass('tips01');
            $('#responsebar').html('');
            $(this).addClass('inputStyle01Hover').removeClass('inputStyleTips');
          }).blur(
          function () {
            if($(this).val() == '') $(this).addClass('inputStyleTips').removeClass('inputStyle01').removeClass('inputStyle01Hover');
          }
    );
    
    //注册TAB
    $('#tab_tit').children().each(function(){
            $(this).click(function(){
                $('#tab_tit').children().addClass('topTabNormal').removeClass('topTabAction');
                $('.loginContent').hide();
                $(this).addClass('topTabAction').removeClass('topTabNormal');
                $('#tab_'+$(this).attr('rel')).show();  
            });
    });
    
    //popRegTAB
    $('#pop_regNav').children("span").each(function(){
        $(this).click(function(){
                $('#pop_regNav').children("span").addClass('red');
                $('#tab_reg .loginDetail').hide();
                $(this).removeClass('red');
                $('#tab_'+$(this).attr('rel')).show();  
            });
    });
    
    //鼠标经过改变样式
    $("input[class='inputStyle01'],input[class='inputStyleTips']").click(
          function (){
            $('#responsebar').removeClass('tips01');
            $('#responsebar').html('');
            $(this).removeClass('inputStyle01').addClass('inputStyle01Hover');
            var tips = $(this).attr("tips");
            if(!$.isempty(tips) && ($(this).parent("p").next("div").attr("class") != "tips01")  && ($(this).parent().parent("li").attr("class") != "infoRight"))  $(this).parent("p").next("div").removeClass("tips01").addClass("tips02").html(tips);
          }).blur(
          function (){
            $(this).removeClass('inputStyle01Hover').addClass('inputStyle01');
            if($(this).parent("p").next("div").attr("class") == "tips02") $(this).parent("p").next("div").removeClass("tips02").html('');
          }
    );
    
    $("input[class='inputStyle02']").click(
          function (){
            $('#responsebar').removeClass('tips01');
            $('#responsebar').html('');
            $(this).removeClass('inputStyle02').addClass('inputStyle02Hover');
            var tips = $(this).attr("tips");
            if(!$.isempty(tips) && ($(this).parent("p").next("div").attr("class") != "tips01") && ($(this).parent().parent("li").attr("class") != "infoRight") ) $(this).parent("p").next("div").removeClass("tips01").addClass("tips02").html(tips);
          }).blur(
          function (){
            $(this).removeClass('inputStyle02Hover').addClass('inputStyle02');
            if($(this).parent("p").next("div").attr("class") == "tips02") $(this).parent("p").next("div").removeClass("tips02").html('');
          }
    );
    
    if($("#frmLogin").length >0 ){
    $("#frmLogin").validate({
        onfocusout:false,
        onkeyup:false,
        onclick:false,
        errorClass: "",
        errorElement: "font",
        success: function(label) {
        },
        errorPlacement: function(error, element) {
        },
        rules:{
                'user': {
                        required: true
                        },
                'pass': {
                        required:true
                        }
              },
        messages: {
                },
        submitHandler: function(form) {
            $("#frmLogin").ajaxSubmit({
                cache: false,
                description: '',
                resetForm: false,
                beforeSubmit: function(){
                    //if($.isempty(quickform)) $.processBlock('frmLogin');
                    //$('#responsebar').addClass('tips01');
                    //notifyReponseBar('登录中 ...');
                },
                success: function(resp){try{
                    var retcode = resp.substring(0,1);
                    var retinfo = resp.substring(1,resp.length);
                    if( retcode == 1 ){
                        resp = retcode;
                        //$('#responsebar').append(retinfo);
                        //ayAsyncTrack_callback();
                    }
                    //$('#responsebar').show();
                    var retcode = $.dealWithRetInDialog(resp,true);

                    if(retcode.code == 1){

                        if(!$.isempty(quickform) && $.isempty(redirecto) && (quickform != 'pop')) {
                            window.self.location.reload();
                        }else{
                            var url = redirecto;
                            if( retinfo == bankCodeHkbea ){
                                url =  g_baseUrls.base+'/banktrack.php4?custreferrekey='+bankCodeHkbea+'&url='+url;
                            }
                            //登录后的跳转问题，从登出页面和注册页面过来的登录，跳转到首页 2013-7-5 by zhuminghua
                            if(('/auth/logout/tojump/1' == url) || ('/auth/reg/tojump/1' == url) || ('/auth/login/tojump/1' == url)){
                                url = g_baseUrls.base;
                            }
                            //登录后的跳转问题，从登出页面和注册页面过来的登录，跳转到首页 2013-7-5 by zhuminghua
                            //setTimeout(function(){window.top.document.location.href = url},2000);
                            
                            window.location.href = url;
                        }
                    }
                    else{
                        $('.loginMsg').html('登录信息不正确，请你重新填写');
                        if($.isempty(quickform)) $('#frmLogin').unblock();
                        /*switch(retcode.errcode){
                            case 138:
                            $('#frmLogin').find('input:text[@name="captcha"]').focus();
                            break;
                            case 119:
                            $('#frmLogin').find('input:password[@name="pass"]').focus();
                            break;
                            case 110:
                            $('#check_start').show();
                            //commonPromptPop({'parentId':'contentdetail','promptMsg':'<div style="text-align:left; text-indent:24px;padding:20px;">亲爱的会员您好，为了使您更好地使用我们的网站以及便于我们向您提供更好的服务，我们于即日起升级了会员系统。需要麻烦您对手机或邮箱进行补充及认证，请关闭本提示窗口后，选择手机号码、Email地址其中之一填写，并点击”获取认证码“，将收到的六位认证码填写到身份认证码进行身份验证。<br>对此造成的不便，我们向您致以真诚的歉意。</div>','title':'友情提示','width':500});
                            break;
                            default:
                            $('#frmLogin').find('input:text[@name="user"]').focus();
                            break;
                        }*/
                    }
                }catch(e){}}
            });
            // it's important!
            return false;
        }
    });
    }
    
    $('#regphone_submit').click(function(){
//        if((0 == $('#validatePhone').val()) && (0 == $('#validateEmail').val())){
//            $('#emailMsg').parent("li").addClass("infoWrong");
//            $('#emailMsg').html('请输入常用邮箱');//邮箱或手机号码至少填写一个
//            $('#emailMsg').addClass('tips01');
//        }
    });
    
    /*$('#phone').blur(function(){
        var phone_value = $('#phone').val();
        if('' == phone_value){
            $('#validatePhone').val('0');
            $('#phoneMsg').parent("li").removeClass("infoRight");
            $('#phoneMsg').parent("li").removeClass("infoWrong");
            $('#phoneMsg').removeClass('tips01');
            $('#phoneMsg').html('');
            $('#msgInput').hide();//手机号码输入正确，则显示短信验证框,2013.6.5
            return false;
        }
        var url = g_baseUrls.base+'/auth/phoneCheck';
        $.ajax({
            type: 'post',
            url: url,
            data : {'user_phone':phone_value},
            dataType : 'json',
            success: function(resp){try{
                        if( !$.isempty(resp) ){
                            //alert(resp.errcode);return false;
                            if(resp.errcode == 2){//该手机已经存在，请重新填写
                                $('#phoneMsg').parent("li").addClass("infoWrong");
                                $('#phoneMsg').html(resp.errmsg);
                                $('#phoneMsg').addClass('tips01');
                                $('#msgInput').hide();//手机号码输入正确，则显示短信验证框,2013.6.5
                                $('#regType').val('email');
                                $('#validatePhone').val('0');
                                //$('#checker_str').rules("remove", "required");
                                //$('#email').rules("add", {required:true, email:true, remote:g_baseUrls.base+"/auth/member/ajaxcheck/email", messages:{required:"请输入常用的邮箱地址", remote:"Email地址无效或已经被注册"}});
                            }else if(resp.errcode == 1){//非法的手机号码
                                $('#phoneMsg').parent("li").addClass("infoWrong");
                                $('#phoneMsg').html(resp.errmsg);
                                $('#phoneMsg').addClass('tips01');
                                $('#msgInput').hide();//手机号码输入正确，则显示短信验证框,2013.6.5
                                $('#regType').val('phone');
                                $('#validatePhone').val('0');
                                //$('#checker_str').rules("add", {required:true, messages:{required:"请输入手机接收的字母"}});//如果输入手机后，则验证码是必填内容
                                //$('#email').rules("add", {required:true, email:true, remote:g_baseUrls.base+"/auth/member/ajaxcheck/email", messages:{required:"请输入常用的邮箱地址", remote:"Email地址无效或已经被注册"}});
                            }else{//手机号码通过
                                $('#phoneMsg').parent("li").removeClass("infoWrong");
                                $('#phoneMsg').parent("li").addClass("infoRight");
                                $('#phoneMsg').removeClass('tips01');
                                $('#phoneMsg').html("");
                                $('#msgInput').show();//手机号码输入正确，则显示短信验证框,2013.6.5
                                $('#regType').val('phone');
                                $('#validatePhone').val('1');
                                $('#emailMsg').parent("li").removeClass("infoWrong");
                                $('#emailMsg').removeClass('tips01');
                                $('#emailMsg').html("");
                                buttonEnabled('get_checknum','');
                                //$('#checker_str').rules("add", {required:true, messages:{required:"请输入手机接收的字母"}});//如果输入手机后，则验证码是必填内容
                                //$('#email').rules("remove");//手机号码有效，邮箱为非必填
                            }
                        }
                    }catch(e){}}
        });
    });*/
    
    $('#email').blur(function(){
        /*if(1 == $('#validatePhone').val()){
            return false;
        }*/
        var email_value = $('#email').val();
        if('' == email_value){
            return false;
        }
        var url = g_baseUrls.base+'/auth/emailCheck';
        $.ajax({
            type: 'post',
            url: url,
            data : {'user_email':email_value},
            dataType : 'json',
            success: function(resp){try{
                        if( !$.isempty(resp) ){
                            //alert(resp.errcode);alert(resp.errmsg);return false;
                            if(resp.errcode == 2){//email已经存在，请重新填写
                                $('#validateEmail').val('0');
                                $('#emailMsg').parent("li").addClass("infoWrong");
                                $('#emailMsg').html(resp.errmsg);
                                $('#emailMsg').addClass('tips01');
                                $('#regType').val('phone');
                            }else if(resp.errcode == 1){//email格式错误
                                $('#validateEmail').val('0');
                                $('#emailMsg').parent("li").addClass("infoWrong");
                                $('#emailMsg').html(resp.errmsg);
                                $('#emailMsg').addClass('tips01');
                                $('#regType').val('phone');
                            }else{//邮箱通过
                                $('#validateEmail').val('1');
                                $('#emailMsg').parent("li").removeClass("infoWrong");
                                $('#emailMsg').parent("li").addClass("infoRight");
                                $('#emailMsg').removeClass('tips01');
                                $('#emailMsg').html("");
                                $('#regType').val('email');
                            }
                        }
                    }catch(e){}}
        });
    });
    
    $('#checker_str').blur(function(){
        if('' != $('#checker_str').val()){
            $('#checkerStrMsg').parent("li").removeClass("infoWrong");
            $('#checkerStrMsg').parent("li").addClass("infoRight");
            $('#checkerStrMsg').removeClass("tips01");
            $('#checkerStrMsg').html("");
        }else{
            $('#checkerStrMsg').parent("li").addClass("infoWrong");
            $('#checkerStrMsg').html('请输入短信验证码');
            $('#checkerStrMsg').addClass('tips01');
            return false;
        }
    });
    
    if($('#phoneEmailReg').length > 0){
        $('#phoneEmailReg').validate({
            errorClass : "",
            errorElement : "font",
            success : function(label){
                label.parent("div").parent("li").removeClass("infoWrong");
                label.parent("div").parent("li").addClass("infoRight");
                label.parent("div").removeClass("tips01");
                label.parent("div").html("");
            },
            errorPlacement : function(error, element){
                element.parent("p").parent("li").removeClass("infoRight");
                element.parent("p").parent("li").addClass("infoWrong");
                element.parent("p").next("div").html("");
                error.appendTo(element.parent("p").next("div"));
                element.parent("p").next("div").addClass('tips01');
            },
            rules : {
                'phone' : {
                    required : true,
                    mobile : true,
                    remote : g_baseUrls.base+'/auth/phoneCheck/ajaxcheck/phone' //验证手机号码的唯一性
                },
                'checker_str': {
                    required: true,
                    rangeLength: [6,6]
                },
                'email' : {
                    required: true,
                    email: true,
                    maxLength:40,
                    remote:  g_baseUrls.base+'/auth/member/ajaxcheck/email'
                },
                'nick': {
                    required: true,
                    mbrangeLength: [4,12],
                    remote:  g_baseUrls.base+'/auth/member/ajaxcheck/nick'
                },
                'random_str': {
                    required: true,
                    mbrangeLength: [4,4],
                    remote:  g_baseUrls.base+'/auth/member/ajaxcheck/hash'
                }
            },
            messages: {
                'phone':{
                    required: '请输入手机号。',
                    remote: '该手机号码已经被注册。'
                },
                'checker_str': {
                    required: '请输入手接收的字母',
                    rangeLength: '长度必须是6个大写字母'
                },
                'email': {
                    maxLength: '邮箱地址不能超过40个字符',
                    required: '请输入常用的邮箱地址',
                    remote: 'Email地址无效或已经被注册'
                },
                'nick': {
                    required: '请输入昵称 长度为4-12个字符',
                    remote: '昵称已被使用或包含非法字符',
                    mbrangeLength: '长度必须是 4 至 12 个字符'
                },
                'lpass': {
                    required: '请输入登录网站的密码'
                },
                'lrepass': {
                    required: '请再次输入密码',
                    equalTo: '重复输入的密码不一致'
                }/*,
                'random_str': {
                    required: '请输入验证码',
                    mbrangeLength: '验证码为4个字符',
                    remote: '请输入正确验证码'
                }*/
            },
            submitHandler: function(form) {
//                if((0 == $('#validatePhone').val()) && (0 == $('#validateEmail').val())){
//                    $('#emailMsg').parent("li").addClass("infoWrong");
//                    $('#emailMsg').html('请输入常用邮箱');
//                    $('#emailMsg').addClass('tips01');
//                    return false;
//                }
                if((1 == $('#validatePhone').val()) && ('' == $('#checker_str').val())){
                    
                    $('#checkerStrMsg').parent("li").addClass("infoWrong");
                    $('#checkerStrMsg').html('请输入短信验证码');
                    $('#checkerStrMsg').addClass('tips01');
                    return false;
                }else{
                    $('#checkerStrMsg').parent("li").removeClass("infoWrong");
                    $('#checkerStrMsg').parent("li").addClass("infoRight");
                    $('#checkerStrMsg').removeClass("tips01");
                    $('#checkerStrMsg').html("");
                }
                $("#phoneEmailReg").ajaxSubmit({
                    description: '',
                    resetForm: false,
                    beforeSubmit: function(){
                       
                    if($.isempty(quickform))    $.processBlock('auth_reg');
        
                       // notifyReponseBar('提交注册信息中 ...');
                    },
                    success: function(resp){//try{
                        var retcode = $.dealWithRetInDialogMsg(resp,true);
                        $('#responsebar').empty();
                        var response_msg = retcode.info;
                        if(retcode.code == 1){
                            $('#responsebar').empty();
                            var i = eval('('+retcode.info+')');
                            if(!server_test){
                                try{
                                    //if(typeof _gaq == 'undefined') _gaq = [];
                                    _gaq.push(
                                        ['_addTrans',
                                        "REG2:"+i.uid,
                                        "zbird",
                                        "0.2",
                                        "0",
                                        "0",
                                        "shanghai",
                                        "shanghai",
                                        "China"
                                        ],
                                        ['_addItem',
                                        "REG:"+i.uid,
                                        i.uid,
                                        "会员注册",
                                        "会员注册",
                                        "0.1",
                                        "1"
                                        ],
                                        ['_trackTrans']
                                    );
                                }catch(e){}
                            }
                            var url = i.url;
                            if(quickform == 'pop') {
                                //regsucc(118704);//AdSage tracking
                                if($.isempty(url)){
                                    window.self.location.reload();
                                }else{
                                    setTimeout(function(){window.top.document.location.href = url;},1500);
                                }   
                            }else{
                                if($.isempty(url)){
                                    url = g_baseUrls.base+'/auth/regsuccess?user='+i.phone;
                                    if( !$.isempty(code) ) url += '&code='+code;
                                }else{
                                    if(url.indexOf('?') == -1) url += '?';
                                }
                                url += '&type=phone';
                                
                                setTimeout(function(){window.top.document.location.href = url;},1500);
                            }
                        }
                        else{
                            
                            if(!quickform) $('#auth_reg').unblock();
                            
                            switch(retcode.errcode){
                                case 2:
                                $('#frmMemberReg').find('form[@name="phoneReg"] input:password[@name="lpass"]').focus();
                                break;
                                case 3:
                                $('#frmMemberReg').find('form[@name="phoneReg"] input:text[@name="nick"]').focus();
                                break;
                                case 4:
                                $('#frmMemberReg').find('form[@name="phoneReg"] input:text[@name="captcha"]').focus();
                                break;
                                default:
                                $('#frmMemberReg').find('form[@name="phoneReg"] input:text[@name="email"]').focus();
                            }
                            $('#captcha_hash_reg').val(retcode.rdStr);//添加随机码赋值功能
                            commonPromptPop({'parentId':'auth_reg','promptMsg':response_msg,'title':'提示','width':300});
                        }
                    //}catch(e){}
                    },
                    error: function(){
                         if(!quickform) $('#auth_reg').unblock();
                       // notifyReponseBar('注册信息提交失败，请稍候再试。');
                    }
                });
                
                return false;
            }
        });
    }
    


    //获取短信验证码
    $('#get_checknum').click(function(){
        //var phone_value = $('form[@name="phoneEmailReg"] input[@id="phone"]').val();
        var captcha_hash_reg = $('#captcha_hash_reg').val();
        var phone_value = $('#phone').val();
        if($.isempty(phone_value) || phone_value.length!=11||! /^1[3578][0-9]\d{8}$/.test(phone_value)){
            //commonPromptPop({'parentId':'auth_reg','promptMsg':'请正确填写您的手机号码。','title':'提示','width':300});
            return false;
        }   
        //$.processBlock('auth_reg');
        //$('#responsebar').html('处理中，如果您长时间收不到请关闭重试，或用邮箱注册。');
        //timeover('get_checknum',5,'可以再次点击','免费获取手机验证码');
        buttonDisabled('get_checknum','');
        var url = g_baseUrls.base+'/auth/msgSend';
        $.ajax({
            type: 'post',
            url: url,
            data : {'user_phone':phone_value,'msg_type':'check','captcha':phone_captcha, 'captcha_hash_reg':captcha_hash_reg},
            success: function(resp){try{
                        if( !$.isempty(resp) ){
                            var retcode = $.dealWithRetInDialogMsg(resp,true);
                            //alert(retcode.errcode);alert(retcode.code);return false;//需要验证码或验证码错误
                            if(retcode.errcode == 36){
                                location.reload();
                                return false;
                            }
                            if(retcode.errcode == 113){
                                $('#captcha_hash_reg').val(retcode.rdStr);//添加随机码赋值功能
                                //alert(retcode.errcode);
                                var str =  '';
                                str +=  '<dl id="phonecheck">';
                                    str +=  '<dd>手机号码【'+phone_value+'】认证</dd>';
                                    str +=  '<dd>验证码：<input type="text" class="text" id="phone_captcha" name="phone_captcha" value="" style="width: 160px;ime-mode: disabled;" autocomplete="off" maxlength="4" /></dd>';
                                    str +=  '<dd><img src="/auth/captcha/size/4>/r/';
                                    str +=  ((new Date()).getTime())+'"  align="absmiddle" id="regCaptchaPic1" /></dd>';
                                    str +=  '<dd><input type="button" name="getcheckbyphone" id="getcheckbyphone" value="获取手机验证码"  class="pointer" /></dd>';
                                str +=  '</dl>';
                                commonPromptPop({'parentId':'tab_phone','promptMsg':str,'title':retcode.info,'width':500});
                                
                                $('#regCaptchaPic1').click(function(){try{
                                    $(this)
                                    .load(function(){$(this).unbind('load');})
                                    .attr('src','/auth/captcha/size/4/r/'+((new Date()).getTime()));
                                }catch(e){}});
                                
                                $('#getcheckbyphone').click(function(){
                                    phone_captcha = $('#phone_captcha').val();
                                    if($.isempty(phone_captcha)){
                                        alert('请输入验证码！');
                                    }else{
                                        $('#get_checknum').click();
                                        $('#commonPromptPopClose').click();
                                    }
                                });
                            }else if(retcode.code == 1){
                                timeover('get_checknum',60,'再次发送','免费获取手机验证码');
                                $('#captcha_hash_reg').val(retcode.rdStr);//添加随机码赋值功能
                            }else{
                                $('#captcha_hash_reg').val(retcode.rdStr);//添加随机码赋值功能
                                commonPromptPop({'parentId':'tab_phone','promptMsg':retcode.info,'title':'提示信息：','width':500});
                            }
                        }
                    }catch(e){}}
        });
    
    });
    
    //会员卡激活
    
    
    //会员卡激活
    $('#getPass').click(function(){
        var phone_value =  $('#member_phone').val();
        var user = $('#userMember').val();
        var captcha_hash_reg = $('#captcha_hash_reg_card').val();
        if($.isempty(user)){
            $('.c_cMsg').html('请先填写你的会员卡号后在进行密码获取');
            return;
        }
        if($.isempty(phone_value) || phone_value.length!=11||! /^1[3578][0-9]\d{8}$/.test(phone_value)){
            $('.c_pMsg').html('请正确填写您的手机号码。');
            return;
        }else{
            $('.c_pMsg').html('');
        }
        var url = g_baseUrls.base+'/auth/msgSend';
        $.ajax({
            type: 'post',
            url: url,
            data : {'card_no':user,'user_phone':phone_value,'msg_type':'pwd','captcha_hash_reg':captcha_hash_reg},
            success: function(resp){try{
                        if( !$.isempty(resp) ){
                            var retcode = $.dealWithRetInDialogMsg(resp,true);
                            if(retcode.errcode == 36){
                                location.reload();
                                return false;
                            }
                            $('#responsebar').empty();
                            var response_msg = retcode.info;
                            if(retcode.code == 1){
                                $('.c_cMsg').html('');
                                $('#captcha_hash_reg_card').val(retcode.rdStr);//添加随机码赋值功能
                                timeover('getPass',60,'再次发送','获取开卡密码');
                            }else{
                                $('#captcha_hash_reg_card').val(retcode.rdStr);//添加随机码赋值功能
                                timeover('getPass',60,'再次发送','获取开卡密码');
                                $('.c_cMsg').html(response_msg);
                            }
                        }
                    }catch(e){}}
        });
    
    });
    
    //验证码
    $('a[name="regCaptchaPic"]').click(function(){
        try{
            $('img[name="regCaptchaPic"]')
            .load(function(){
                $(this).unbind('load');
            })
            .attr('src',g_baseUrls.base+'/auth/captcha/size/4/r/'+((new Date()).getTime()));
        }catch(e){}
    });
});

//按钮disabled
function buttonDisabled(obj,text){
    var butNode = $('#'+obj);
    butNode.css('cursor','not-allowed');
    butNode.css('color','#C0C0C0');
    butNode.attr("disabled",true);
    //butNode.val(text);
}
//按钮enabled
function buttonEnabled(obj,text){
    var butNode = $('#'+obj);
    //butNode.val(text);
    butNode.attr("disabled",false);
    butNode.css('cursor','pointer');
    butNode.css('color','#666666');
}


function informationProcessing (resp,bReturndetail){
        var g_regExpForReturnDialogAjax = new RegExp('^\\[errcode:([0-9]+)\\]:?((.|\n)*)','i');
        var retcode = resp.substring(0,1);
        var retinfo = resp.substring(1,resp.length);
        var errcode = -999;
        if(retcode != '1'){try{
            var matches = g_regExpForReturnDialogAjax.exec(retinfo);
            if(null != matches){
                errcode = matches[1];
                retinfo = matches[2];
                strs=retinfo.split(",bld,");
                retinfo = strs[0];
            }
        }catch(e){}}
        if($.isempty(bReturndetail) || bReturndetail == false){
            return retcode;
        }
        else{
            return {code:parseInt(retcode),info:retinfo,'errcode':parseInt(errcode)};
        }
    }

//倒计时
function timeover(obj,t,txt,text){
    var count = t;
    var butTime = function(){
        var butNode = $('#'+obj);
        //alert(butNode.val());
        butNode.css('cursor','not-allowed');
        butNode.css('color','#C0C0C0');
        butNode.attr("disabled",true);
        butNode.val(count+"秒后"+txt);
        count--;
        if(count<=0)
        {
        butNode.val(text);
        butNode.attr("disabled",false);
        butNode.css('cursor','pointer');
        butNode.css('color','#666666');
        window.clearInterval(time);
        }
    };
    var time;
    butTime();
    time = window.setInterval(butTime,1000);
}
//关闭弹出窗口
$('#auth_pop_close').click(function(){
    $('#memberLoginPopDiv').remove();
    $(document.body).unblock();
});